Skip to content

Conversation

@grounzero
Copy link
Owner

Transform GraphQL Source Generator into Reusable NuGet Package

This PR transforms the GraphQL source generator project into a fully-featured, reusable NuGet package with comprehensive configuration options, error handling, and documentation.

Changes

Package Configuration

  • Added package metadata to GraphQLSourceGen.csproj
  • Created LICENSE file with MIT license
  • Added CHANGELOG.md for version tracking
  • Configured proper assembly references

Configuration System

  • Created GraphQLSourceGenOptions.cs for configuration options
  • Added MSBuild property support via GraphQLSourceGen.props
  • Implemented customisable settings:
    • Output namespace
    • Records vs classes
    • Init-only vs mutable properties
    • XML documentation comments

Error Handling

  • Added diagnostic descriptors with error codes
  • Implemented validation for fragment names and references
  • Added clear, actionable error messages
  • Improved error reporting in the generator

Code Generation Improvements

  • Added nullable reference type support
  • Fixed nested type generation to avoid naming conflicts
  • Improved XML documentation in generated code
  • Added support for proper C# type mapping

Sample Project

  • Created GraphQLSourceGen.Samples project
  • Added sample GraphQL schema with various fragment types
  • Implemented demo program showing usage of generated types
  • Reorganised folder structure for better maintainability

CI/CD Pipeline

  • Added GitHub Actions workflow for build and test
  • Created workflow for publishing to NuGet on release

Documentation

  • Updated README with comprehensive installation and usage guides
  • Added configuration documentation
  • Included troubleshooting section
  • Added examples for different GraphQL fragment types

Testing

The changes have been tested by:

  • Building the solution with the new structure
  • Verifying the sample project works correctly
  • Checking that the generated code compiles and runs

@grounzero grounzero merged commit 946e1ea into main Apr 24, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants